-
Notifications
You must be signed in to change notification settings - Fork 147
fix: replace deprecated AccountCreateTransaction.set_key usage #1195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: replace deprecated AccountCreateTransaction.set_key usage #1195
Conversation
|
Hi, this is WorkflowBot.
|
📝 WalkthroughWalkthroughReplaces deprecated AccountCreateTransaction.set_key(...) usages with set_key_without_alias(...) across examples and tests; one example switches to set_key_with_alias(...) and changelog/docs updated to document the migration. No other functional changes implied. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~35 minutes
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
examples/tokens/account_allowance_approve_transaction.py (1)
51-57: Critical: Missingfreeze_with(client)beforeexecute.The transaction lifecycle is incomplete. According to SDK requirements,
freeze_with(client)must be called beforeexecute(client)to lock the transaction parameters.🔎 Proposed fix
account_receipt = ( AccountCreateTransaction() .set_key_without_alias(account_public_key) .set_initial_balance(Hbar(1)) .set_account_memo("Account for token allowance") + .freeze_with(client) .execute(client) )Note: The migration to
set_key_without_aliasitself is correct.tests/integration/account_update_transaction_e2e_test.py (1)
186-186: Replace deprecated AccountCreateTransaction.set_key() with set_key_without_alias() at lines 186, 238, 276, 305, and 383.The
.set_key()method is deprecated. Other instances in this file have already been migrated to.set_key_without_alias()(lines 28, 104, 142, 341, 351). Complete the migration consistently.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (54)
CHANGELOG.mddocs/sdk_users/running_examples.mdexamples/account/account_allowance_approve_transaction_hbar.pyexamples/account/account_allowance_approve_transaction_nft.pyexamples/account/account_allowance_delete_transaction_hbar.pyexamples/account/account_allowance_delete_transaction_nft.pyexamples/account/account_create_transaction.pyexamples/account/account_create_transaction_evm_alias.pyexamples/account/account_delete_transaction.pyexamples/account/account_records_query.pyexamples/account/account_update_transaction.pyexamples/consensus/topic_create_transaction_revenue_generating.pyexamples/logger/logging_example.pyexamples/query/account_balance_query_2.pyexamples/query/account_info_query.pyexamples/query/transaction_get_receipt_query.pyexamples/query/transaction_record_query.pyexamples/schedule/schedule_create_transaction.pyexamples/schedule/schedule_delete_transaction.pyexamples/schedule/schedule_info_query.pyexamples/schedule/schedule_sign_transaction.pyexamples/tokens/account_allowance_approve_transaction.pyexamples/tokens/token_airdrop_claim_auto.pyexamples/tokens/token_airdrop_claim_signature_required.pyexamples/tokens/token_airdrop_transaction.pyexamples/tokens/token_airdrop_transaction_cancel.pyexamples/tokens/token_associate_transaction.pyexamples/tokens/token_create_transaction_freeze_key.pyexamples/tokens/token_create_transaction_kyc_key.pyexamples/tokens/token_create_transaction_max_automatic_token_associations_0.pyexamples/tokens/token_create_transaction_pause_key.pyexamples/tokens/token_create_transaction_wipe_key.pyexamples/tokens/token_dissociate_transaction.pyexamples/tokens/token_grant_kyc_transaction.pyexamples/tokens/token_reject_transaction_fungible_token.pyexamples/tokens/token_reject_transaction_nft.pyexamples/tokens/token_revoke_kyc_transaction.pyexamples/tokens/token_wipe_transaction.pyexamples/transaction/transfer_transaction_fungible.pyexamples/transaction/transfer_transaction_hbar.pyexamples/transaction/transfer_transaction_nft.pytests/integration/account_info_query_e2e_test.pytests/integration/account_update_transaction_e2e_test.pytests/integration/batch_transaction_e2e_test.pytests/integration/query_e2e_test.pytests/integration/revenue_generating_topics_e2e_test.pytests/integration/token_grant_kyc_transaction_e2e_test.pytests/integration/token_reject_transaction_e2e_test.pytests/integration/token_revoke_kyc_transaction_e2e_test.pytests/integration/token_update_transaction_e2e_test.pytests/integration/transaction_record_query_e2e_test.pytests/integration/utils.pytests/unit/account_create_transaction_test.pytests/unit/executable_test.py
🧰 Additional context used
📓 Path-based instructions (1)
examples/**/*
⚙️ CodeRabbit configuration file
examples/**/*: You are acting as a senior maintainer reviewing SDK examples. Your goal is to ensure examples work verbatim for users who copy-paste them.Priority 1 - Correctness:
- Verify transaction lifecycle chain (construction -> freeze_with -> sign -> execute).
- Ensure
freeze_with(client)is called BEFORE signing.- Validate that methods referenced actually exist in the
hiero_sdk_pythoncodebase.- Ensure response validation checks
receipt.statusagainstResponseCodeenums (e.g.,ResponseCode.SUCCESS).Priority 2 - Transaction Lifecycle:
- Check method chaining logic.
- Verify correct signing order (especially for multi-sig).
- Ensure explicit
.execute(client)calls.- Verify response property extraction (e.g., using
.token_id,.account_id,.serial_numbers).- Ensure error handling uses
ResponseCode(receipt.status).namefor clarity.Priority 3 - Naming & Clarity:
- Enforce role-based naming:
operator_id/_key,treasury_account_id/_key,receiver_id/_key.- Use
_idsuffix for AccountId and_keysuffix for PrivateKey variables.- Validate negative examples explicitly check for failure codes (e.g.,
TOKEN_HAS_NO_PAUSE_KEY).- Ensure logical top-to-bottom flow without ambiguity.
Priority 4 - Consistency:
- Verify standard patterns:
def main(),if __name__ == "__main__":,load_dotenv().- IMPORT RULES:
- Accept both top-level imports (e.g.,
from hiero_sdk_python import PrivateKey) and fully qualified imports (e.g.,from hiero_sdk_python.crypto.private_key import PrivateKey).- STRICTLY validate that the import path actually exists in the project structure. Compare against other files in
/examplesor your knowledge of the SDK file tree.- Flag hallucinations immediately (e.g.,
hiero_sdk_python.keysdoes not exist).- Check for
try-exceptblocks withsys.exit(1)for critical failures.Priority 5 - User Experience:
- Ensure comments explain SDK usage patterns (for users,...
Files:
examples/tokens/token_airdrop_claim_signature_required.pyexamples/tokens/token_create_transaction_wipe_key.pyexamples/account/account_records_query.pyexamples/tokens/token_airdrop_transaction.pyexamples/schedule/schedule_info_query.pyexamples/transaction/transfer_transaction_hbar.pyexamples/query/transaction_get_receipt_query.pyexamples/tokens/token_grant_kyc_transaction.pyexamples/schedule/schedule_create_transaction.pyexamples/tokens/token_dissociate_transaction.pyexamples/query/account_balance_query_2.pyexamples/account/account_allowance_approve_transaction_hbar.pyexamples/tokens/token_associate_transaction.pyexamples/account/account_allowance_approve_transaction_nft.pyexamples/transaction/transfer_transaction_fungible.pyexamples/account/account_update_transaction.pyexamples/tokens/token_create_transaction_pause_key.pyexamples/tokens/token_wipe_transaction.pyexamples/query/transaction_record_query.pyexamples/consensus/topic_create_transaction_revenue_generating.pyexamples/account/account_create_transaction_evm_alias.pyexamples/tokens/token_create_transaction_max_automatic_token_associations_0.pyexamples/schedule/schedule_sign_transaction.pyexamples/account/account_create_transaction.pyexamples/tokens/token_airdrop_transaction_cancel.pyexamples/account/account_allowance_delete_transaction_nft.pyexamples/transaction/transfer_transaction_nft.pyexamples/tokens/token_create_transaction_kyc_key.pyexamples/tokens/token_reject_transaction_nft.pyexamples/schedule/schedule_delete_transaction.pyexamples/tokens/account_allowance_approve_transaction.pyexamples/account/account_allowance_delete_transaction_hbar.pyexamples/tokens/token_create_transaction_freeze_key.pyexamples/account/account_delete_transaction.pyexamples/tokens/token_airdrop_claim_auto.pyexamples/logger/logging_example.pyexamples/query/account_info_query.pyexamples/tokens/token_revoke_kyc_transaction.pyexamples/tokens/token_reject_transaction_fungible_token.py
🧬 Code graph analysis (49)
examples/tokens/token_airdrop_claim_signature_required.py (1)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)
tests/integration/batch_transaction_e2e_test.py (2)
src/hiero_sdk_python/account/account_create_transaction.py (2)
set_key_without_alias(94-107)AccountCreateTransaction(27-380)src/hiero_sdk_python/transaction/transaction.py (1)
batchify(825-840)
examples/tokens/token_create_transaction_wipe_key.py (3)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)tests/unit/conftest.py (1)
private_key(54-56)src/hiero_sdk_python/crypto/private_key.py (1)
public_key(305-309)
examples/account/account_records_query.py (1)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)
examples/tokens/token_airdrop_transaction.py (2)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)src/hiero_sdk_python/crypto/private_key.py (1)
public_key(305-309)
examples/schedule/schedule_info_query.py (1)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)
examples/transaction/transfer_transaction_hbar.py (2)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)src/hiero_sdk_python/crypto/private_key.py (1)
public_key(305-309)
tests/integration/token_reject_transaction_e2e_test.py (1)
src/hiero_sdk_python/account/account_create_transaction.py (2)
set_key_without_alias(94-107)AccountCreateTransaction(27-380)
examples/query/transaction_get_receipt_query.py (2)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)src/hiero_sdk_python/crypto/private_key.py (1)
public_key(305-309)
tests/integration/account_info_query_e2e_test.py (1)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)
examples/tokens/token_grant_kyc_transaction.py (1)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)
examples/schedule/schedule_create_transaction.py (1)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)
tests/integration/revenue_generating_topics_e2e_test.py (2)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)src/hiero_sdk_python/crypto/private_key.py (1)
public_key(305-309)
examples/tokens/token_dissociate_transaction.py (2)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)src/hiero_sdk_python/crypto/private_key.py (1)
public_key(305-309)
examples/query/account_balance_query_2.py (1)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)
examples/tokens/token_associate_transaction.py (1)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)
examples/account/account_allowance_approve_transaction_nft.py (2)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)src/hiero_sdk_python/crypto/private_key.py (1)
public_key(305-309)
examples/transaction/transfer_transaction_fungible.py (2)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)src/hiero_sdk_python/crypto/private_key.py (1)
public_key(305-309)
examples/account/account_update_transaction.py (1)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)
examples/tokens/token_create_transaction_pause_key.py (1)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)
examples/tokens/token_wipe_transaction.py (1)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)
examples/query/transaction_record_query.py (2)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)src/hiero_sdk_python/crypto/private_key.py (1)
public_key(305-309)
examples/consensus/topic_create_transaction_revenue_generating.py (1)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)
tests/integration/utils.py (2)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)src/hiero_sdk_python/crypto/private_key.py (1)
public_key(305-309)
examples/account/account_create_transaction_evm_alias.py (1)
src/hiero_sdk_python/account/account_create_transaction.py (2)
AccountCreateTransaction(27-380)set_key_with_alias(109-135)
examples/tokens/token_create_transaction_max_automatic_token_associations_0.py (2)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)src/hiero_sdk_python/crypto/private_key.py (1)
public_key(305-309)
examples/schedule/schedule_sign_transaction.py (1)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)
examples/account/account_create_transaction.py (1)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)
examples/tokens/token_airdrop_transaction_cancel.py (2)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)src/hiero_sdk_python/crypto/private_key.py (1)
public_key(305-309)
examples/account/account_allowance_delete_transaction_nft.py (2)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)src/hiero_sdk_python/crypto/private_key.py (1)
public_key(305-309)
examples/transaction/transfer_transaction_nft.py (1)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)
tests/integration/transaction_record_query_e2e_test.py (1)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)
examples/tokens/token_create_transaction_kyc_key.py (1)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)
tests/integration/query_e2e_test.py (1)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)
examples/tokens/token_reject_transaction_nft.py (1)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)
tests/integration/token_update_transaction_e2e_test.py (2)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)src/hiero_sdk_python/crypto/private_key.py (1)
public_key(305-309)
examples/schedule/schedule_delete_transaction.py (1)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)
examples/tokens/account_allowance_approve_transaction.py (1)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)
examples/account/account_allowance_delete_transaction_hbar.py (1)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)
examples/tokens/token_create_transaction_freeze_key.py (2)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)src/hiero_sdk_python/crypto/private_key.py (1)
public_key(305-309)
tests/integration/token_grant_kyc_transaction_e2e_test.py (1)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)
tests/unit/executable_test.py (1)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)
examples/account/account_delete_transaction.py (1)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)
examples/tokens/token_airdrop_claim_auto.py (1)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)
examples/logger/logging_example.py (2)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)src/hiero_sdk_python/crypto/private_key.py (1)
public_key(305-309)
examples/query/account_info_query.py (1)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)
tests/integration/token_revoke_kyc_transaction_e2e_test.py (1)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)
examples/tokens/token_revoke_kyc_transaction.py (1)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)
examples/tokens/token_reject_transaction_fungible_token.py (1)
src/hiero_sdk_python/account/account_create_transaction.py (1)
set_key_without_alias(94-107)
🪛 Ruff (0.14.8)
examples/account/account_create_transaction_evm_alias.py
51-51: f-string without any placeholders
Remove extraneous f prefix
(F541)
🔇 Additional comments (54)
examples/query/account_info_query.py (1)
55-63: LGTM! Correct migration to non-deprecated method.The replacement of
set_key()withset_key_without_alias()is correct and maintains the expected transaction lifecycle. The method chain properly follows the pattern: construction → configuration → freeze_with → sign → execute. Using the public key (rather than private key) for account creation is appropriate.examples/tokens/token_create_transaction_wipe_key.py (1)
78-78: LGTM: Correct migration toset_key_without_alias.The API migration from deprecated
set_key()toset_key_without_alias()is correctly applied, preserving method chaining and using the public key appropriately.examples/schedule/schedule_sign_transaction.py (1)
55-63: LGTM: Correct migration with proper transaction lifecycle.The migration to
set_key_without_alias()is correct, and the transaction lifecycle properly follows the pattern: construction -> freeze_with -> sign -> execute.examples/account/account_records_query.py (1)
47-54: LGTM: Correct migration toset_key_without_alias.The API migration is correct. Transaction lifecycle includes freeze_with before execute, with operator signature applied implicitly during execution.
examples/tokens/token_create_transaction_pause_key.py (1)
195-203: LGTM: Correct migration with proper transaction lifecycle.The migration to
set_key_without_alias()is correct, and the transaction properly follows freeze_with -> sign -> execute pattern.examples/tokens/token_create_transaction_max_automatic_token_associations_0.py (1)
93-101: LGTM: Correct migration toset_key_without_alias.The API migration is correct with proper transaction lifecycle: freeze_with -> sign before execute.
examples/tokens/token_create_transaction_freeze_key.py (1)
181-188: LGTM: Correct migration with proper transaction lifecycle.The migration to
set_key_without_alias()is correct, following the proper freeze_with -> sign -> execute pattern.tests/integration/batch_transaction_e2e_test.py (1)
280-301: LGTM: Correct migration toset_key_without_aliasin test context.All three
AccountCreateTransactioninstances correctly useset_key_without_alias()with thebatchify()pattern for batch transaction testing.examples/tokens/token_airdrop_transaction_cancel.py (1)
53-58: LGTM: Correct migration with proper transaction lifecycle.The migration to
set_key_without_alias()is correct, with the complete transaction lifecycle (freeze_with -> sign -> execute) properly chained on line 58.examples/tokens/token_associate_transaction.py (1)
76-84: LGTM! Correct migration toset_key_without_alias.The transaction lifecycle is properly structured:
freeze_with→sign→execute. The method change from deprecatedset_keytoset_key_without_aliaspreserves method chaining and behavior.examples/tokens/token_airdrop_claim_auto.py (1)
90-99: LGTM! Correct migration toset_key_without_alias.The transaction lifecycle is properly structured with
freeze_with→sign→execute. The deprecated method has been correctly replaced while preserving all functionality.examples/tokens/token_dissociate_transaction.py (1)
55-62: LGTM! Correct migration toset_key_without_alias.The transaction lifecycle is properly structured with
freeze_with→sign→execute. The method replacement preserves all functionality.examples/tokens/token_revoke_kyc_transaction.py (1)
109-116: LGTM! Correct migration toset_key_without_alias.The transaction lifecycle is properly structured with
freeze_with→execute. The operator automatically signs when executing, which is the correct pattern for operator-paid account creation.tests/integration/utils.py (1)
57-62: LGTM! Correct migration toset_key_without_alias.The method replacement is correct. The simplified transaction lifecycle is acceptable for test utility functions.
examples/tokens/token_airdrop_claim_signature_required.py (1)
99-108: LGTM! Correct migration toset_key_without_alias.The transaction lifecycle is properly structured with
freeze_with→sign→execute. The deprecated method has been correctly replaced.examples/schedule/schedule_create_transaction.py (1)
45-53: LGTM! Correct migration toset_key_without_alias.The transaction lifecycle is properly structured with
freeze_with→sign→execute. The method replacement preserves all functionality and follows SDK best practices.examples/account/account_delete_transaction.py (1)
42-42: LGTM! Correct migration to non-deprecated API.The replacement of
set_key()withset_key_without_alias()is correct and aligns with the PR's deprecation migration objectives. The transaction lifecycle (freeze → sign → execute) remains intact.CHANGELOG.md (1)
93-93: LGTM! Clear changelog entry.The changelog entry accurately documents the migration from the deprecated
set_key()method to the newset_key_without_alias()andset_key_with_alias()APIs across examples and tests.examples/transaction/transfer_transaction_fungible.py (1)
59-59: LGTM! Correct API migration.The change from
set_key()toset_key_without_alias()is correct. The transaction lifecycle (freeze → sign → execute) and error handling remain properly structured.examples/schedule/schedule_info_query.py (1)
40-40: LGTM! Correct deprecation fix.The migration to
set_key_without_alias()is correctly applied. Transaction flow and response validation are properly maintained.examples/account/account_allowance_delete_transaction_nft.py (1)
71-71: LGTM! Correct API update.The replacement of
set_key()withset_key_without_alias()is correct and consistent with the repository-wide migration.examples/tokens/token_wipe_transaction.py (1)
55-55: LGTM! Correct migration.The change to
set_key_without_alias()is correct. The transaction maintains proper lifecycle with freeze_with called before execution.tests/integration/token_grant_kyc_transaction_e2e_test.py (1)
22-22: LGTM! Consistent test migration.All three test cases correctly migrate from
set_key()toset_key_without_alias(). The test assertions and error validation remain properly structured.Also applies to: 65-65, 119-119
tests/integration/account_info_query_e2e_test.py (1)
31-31: LGTM! Correct test update.The migration to
set_key_without_alias()is correctly applied in the integration test. Account validation assertions remain intact.examples/tokens/token_reject_transaction_nft.py (1)
57-62: LGTM - Successful migration to non-deprecated API.The change from
set_key()toset_key_without_alias()correctly updates to the non-deprecated API while preserving the existing behavior and method chaining.examples/account/account_create_transaction.py (1)
108-114: LGTM - Proper migration with correct transaction lifecycle.The change to
set_key_without_alias()is correct and maintains the proper transaction lifecycle (freeze → sign → execute).docs/sdk_users/running_examples.md (1)
121-130: LGTM - Documentation correctly updated.The documentation example now correctly demonstrates the updated API using
set_key_without_alias(), maintaining consistency with the actual code examples.examples/query/transaction_record_query.py (1)
55-60: LGTM - Correct API migration.The migration to
set_key_without_alias()is correct and maintains the existing transaction execution pattern.examples/tokens/token_grant_kyc_transaction.py (1)
106-111: LGTM - Proper migration maintaining transaction lifecycle.The change to
set_key_without_alias()correctly updates the API while preserving the transaction lifecycle with properfreeze_with()usage.examples/tokens/token_airdrop_transaction.py (1)
57-64: LGTM - Excellent migration with proper chaining.The migration to
set_key_without_alias()is correct and demonstrates proper method chaining with freeze_with → sign → execute in a single chain.examples/tokens/token_create_transaction_kyc_key.py (1)
92-99: LGTM - Correct migration with proper transaction flow.The change to
set_key_without_alias()correctly updates the API and maintains the proper transaction lifecycle sequence.examples/account/account_update_transaction.py (1)
44-52: LGTM - Correct migration for AccountCreateTransaction.The change to
set_key_without_alias()onAccountCreateTransactionis correct. Note that line 110's use ofset_key()onAccountUpdateTransactionis intentionally unchanged, as the deprecation only applies toAccountCreateTransaction.examples/query/transaction_get_receipt_query.py (1)
52-52: LGTM!The method replacement from
set_keytoset_key_without_aliasis correct and preserves the transaction chaining behavior.examples/transaction/transfer_transaction_nft.py (1)
59-59: LGTM!The method replacement is correct and the transaction lifecycle (freeze_with before execute) is properly maintained.
tests/integration/revenue_generating_topics_e2e_test.py (2)
531-531: LGTM!The method replacement is correct. Direct execution without explicit
freeze_withis acceptable in test code as the SDK handles freezing internally.
594-594: LGTM!The method replacement is correct and consistent with the other account creation in this test file.
examples/account/account_allowance_delete_transaction_hbar.py (1)
43-43: LGTM!The method replacement is correct and properly chains with the other transaction setters.
examples/transaction/transfer_transaction_hbar.py (1)
51-51: LGTM!The method replacement is correct and the transaction follows the proper lifecycle pattern (freeze_with before sign before execute).
tests/integration/transaction_record_query_e2e_test.py (1)
25-25: LGTM!The method replacement is correct and appropriate for the test context.
examples/account/account_allowance_approve_transaction_hbar.py (1)
43-43: LGTM!The method replacement is correct and maintains the existing transaction construction pattern.
tests/integration/query_e2e_test.py (1)
25-25: LGTM!All method replacements are correct and consistent throughout the test file. The usage of
set_key_without_aliasproperly replaces the deprecatedset_keymethod.Also applies to: 75-75, 132-132, 171-171, 217-217
examples/account/account_allowance_approve_transaction_nft.py (1)
69-69: LGTM! Correct migration toset_key_without_alias.The refactoring correctly replaces the deprecated
set_key()withset_key_without_alias(), maintaining the same behavior and method chaining pattern. The method exists in the SDK and the transaction lifecycle is correct for direct execution.examples/schedule/schedule_delete_transaction.py (1)
52-52: LGTM! Correct migration with proper transaction lifecycle.The refactoring correctly uses
set_key_without_alias()and maintains the proper transaction lifecycle:freeze_with(client)is called before signing, which is the correct order.examples/query/account_balance_query_2.py (1)
59-59: LGTM! Clean refactoring of deprecated method.The migration to
set_key_without_alias()is correct and maintains the same behavior. Direct execution withoutfreeze_withis an acceptable pattern for simple account creation.examples/logger/logging_example.py (1)
107-107: LGTM! Correct refactoring with proper transaction lifecycle.The change correctly uses
set_key_without_alias()and the transaction follows the proper lifecycle pattern withfreeze_withcalled beforesign.tests/integration/token_revoke_kyc_transaction_e2e_test.py (1)
23-23: LGTM! Consistent test migration toset_key_without_alias.All three test cases correctly migrate from the deprecated
set_key()toset_key_without_alias(). The refactoring is consistent across the test suite and maintains the expected behavior.Also applies to: 75-75, 127-127
tests/unit/executable_test.py (1)
55-55: LGTM! Comprehensive unit test migration.All nine instances across the unit tests correctly use
set_key_without_alias(). The refactoring maintains test behavior and covers all the retry/error handling scenarios properly.Also applies to: 78-78, 118-118, 155-155, 191-191, 222-222, 256-256, 294-294, 410-410
examples/consensus/topic_create_transaction_revenue_generating.py (1)
67-67: LGTM! Correct refactoring in revenue-generating topic example.The migration to
set_key_without_alias()is correct and maintains the same behavior for account creation in this complex example demonstrating custom fees.examples/tokens/token_reject_transaction_fungible_token.py (1)
57-57: LGTM! Correct refactoring in token rejection example.The change correctly uses
set_key_without_alias()and maintains the same behavior. The transaction pattern is appropriate for the fungible token rejection demonstration.examples/account/account_create_transaction_evm_alias.py (1)
56-56: LGTM!Correctly uses
set_key_with_alias()to automatically derive the EVM address alias from the ECDSA public key.tests/integration/token_reject_transaction_e2e_test.py (1)
116-116: LGTM!All instances correctly updated to use
set_key_without_alias(), maintaining consistency across the test file.Also applies to: 177-177, 883-883, 903-903
tests/integration/account_update_transaction_e2e_test.py (1)
28-28: LGTM!These instances correctly use
set_key_without_alias()as per the PR objectives.Also applies to: 104-104, 142-142, 341-341, 351-351
tests/unit/account_create_transaction_test.py (1)
45-45: LGTM!These instances correctly migrate to
set_key_without_alias()for non-alias scenarios, consistent with the PR objectives.Also applies to: 70-70, 105-105, 170-170, 237-237, 334-334, 360-360, 386-386, 394-394
tests/integration/token_update_transaction_e2e_test.py (1)
113-113: LGTM!Both instances correctly updated to use
set_key_without_alias().Also applies to: 177-177
|
[commit-verification-bot] To achieve verified status, please read: Remember, you require a GPG key and each commit must be signed with: Thank you for contributing! From the Hiero Python SDK Team |
ffdca53 to
6864194
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (5)
examples/account/account_create_transaction_evm_alias.py (1)
66-68: Add receipt validation for correctness and user education.The example directly accesses
response.account_idwithout retrieving the receipt or validating the transaction status. Per Priority 1 guidelines, examples should demonstrate the complete pattern: get receipt → validate status → extract result.🔎 Recommended pattern with receipt validation
First, add
ResponseCodeto the imports at the top of the file:from hiero_sdk_python import ( Client, PrivateKey, AccountCreateTransaction, AccountInfoQuery, Network, AccountId, Hbar, + ResponseCode, )Then update the execution and validation:
- # Execute the transaction - response = transaction.execute(client) - new_account_id = response.account_id - print(f"✅ Account created with ID: {new_account_id}\n") + # Execute the transaction and get receipt + response = transaction.execute(client) + receipt = response.get_receipt(client) + + # Validate transaction success + if receipt.status != ResponseCode.SUCCESS: + print(f"❌ Transaction failed with status: {ResponseCode(receipt.status).name}") + sys.exit(1) + + new_account_id = receipt.account_id + print(f"✅ Account created with ID: {new_account_id}\n")examples/tokens/token_create_transaction_wipe_key.py (2)
117-123: Critical: Missingfreeze_with(client)beforeexecute(client).The transaction lifecycle is incomplete. Per SDK requirements,
freeze_with(client)must be called beforeexecute(client). This will fail at runtime.🔎 Proposed fix
transfer_tx = ( TransferTransaction() .add_token_transfer(token_id, client.operator_account_id, -amount) .add_token_transfer(token_id, recipient_id, amount) + .freeze_with(client) ) receipt_transfer = transfer_tx.execute(client)
315-319: Critical: Missingfreeze_with(client)beforeexecute(client).The NFT transfer transaction is missing
freeze_with(client)in its lifecycle. This must be called beforeexecute(client).🔎 Proposed fix
transfer_tx = ( TransferTransaction() .add_nft_transfer(NftId(nft_token_id, serial_number), operator_id, user_id) + .freeze_with(client) .execute(client) )tests/unit/account_create_transaction_test.py (2)
329-336: Critical: Non-ECDSA key used withset_key_with_alias().Line 329 generates an Ed25519 key via
PrivateKey.generate(), but line 334 callsset_key_with_alias(public_key). According totest_create_account_transaction_set_key_with_alias_non_ecdsa_key(lines 308-324),set_key_with_alias()raisesValueErrorwhen used with non-ECDSA keys.This test will fail at runtime.
🔎 Proposed fix
Either use
set_key_without_alias()if no alias derivation is needed:- public_key = PrivateKey.generate().public_key() + public_key = PrivateKey.generate().public_key() evm_address = PrivateKey.generate_ecdsa().public_key().to_evm_address() tx = ( AccountCreateTransaction() - .set_key_with_alias(public_key) + .set_key_without_alias(public_key) .set_alias(evm_address) )Or generate an ECDSA key if alias derivation is intended:
- public_key = PrivateKey.generate().public_key() + public_key = PrivateKey.generate_ecdsa().public_key() evm_address = PrivateKey.generate_ecdsa().public_key().to_evm_address()
349-362: Critical: Same non-ECDSA key issue.Line 352 generates an Ed25519 key, but line 360 calls
set_key_with_alias(public_key), which requires ECDSA keys. This test will fail at runtime with the same issue as the previous test.🔎 Proposed fix
- public_key = PrivateKey.generate().public_key() + public_key = PrivateKey.generate().public_key() evm_address = PrivateKey.generate_ecdsa().public_key().to_evm_address() evm_string = evm_address.to_string() alias_str = "0x" + evm_string if with_prefix else evm_string tx = ( AccountCreateTransaction() - .set_key_with_alias(public_key) + .set_key_without_alias(public_key) .set_alias(alias_str) )
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (3)
examples/account/account_create_transaction_evm_alias.pyexamples/tokens/token_create_transaction_wipe_key.pytests/unit/account_create_transaction_test.py
🧰 Additional context used
📓 Path-based instructions (1)
examples/**/*
⚙️ CodeRabbit configuration file
examples/**/*: You are acting as a senior maintainer reviewing SDK examples. Your goal is to ensure examples work verbatim for users who copy-paste them.Priority 1 - Correctness:
- Verify transaction lifecycle chain (construction -> freeze_with -> sign -> execute).
- Ensure
freeze_with(client)is called BEFORE signing.- Validate that methods referenced actually exist in the
hiero_sdk_pythoncodebase.- Ensure response validation checks
receipt.statusagainstResponseCodeenums (e.g.,ResponseCode.SUCCESS).Priority 2 - Transaction Lifecycle:
- Check method chaining logic.
- Verify correct signing order (especially for multi-sig).
- Ensure explicit
.execute(client)calls.- Verify response property extraction (e.g., using
.token_id,.account_id,.serial_numbers).- Ensure error handling uses
ResponseCode(receipt.status).namefor clarity.Priority 3 - Naming & Clarity:
- Enforce role-based naming:
operator_id/_key,treasury_account_id/_key,receiver_id/_key.- Use
_idsuffix for AccountId and_keysuffix for PrivateKey variables.- Validate negative examples explicitly check for failure codes (e.g.,
TOKEN_HAS_NO_PAUSE_KEY).- Ensure logical top-to-bottom flow without ambiguity.
Priority 4 - Consistency:
- Verify standard patterns:
def main(),if __name__ == "__main__":,load_dotenv().- IMPORT RULES:
- Accept both top-level imports (e.g.,
from hiero_sdk_python import PrivateKey) and fully qualified imports (e.g.,from hiero_sdk_python.crypto.private_key import PrivateKey).- STRICTLY validate that the import path actually exists in the project structure. Compare against other files in
/examplesor your knowledge of the SDK file tree.- Flag hallucinations immediately (e.g.,
hiero_sdk_python.keysdoes not exist).- Check for
try-exceptblocks withsys.exit(1)for critical failures.Priority 5 - User Experience:
- Ensure comments explain SDK usage patterns (for users,...
Files:
examples/tokens/token_create_transaction_wipe_key.pyexamples/account/account_create_transaction_evm_alias.py
🧬 Code graph analysis (3)
tests/unit/account_create_transaction_test.py (1)
src/hiero_sdk_python/account/account_create_transaction.py (4)
set_key_without_alias(94-107)AccountCreateTransaction(27-380)set_key_with_alias(109-135)set_alias(220-244)
examples/tokens/token_create_transaction_wipe_key.py (1)
src/hiero_sdk_python/account/account_create_transaction.py (2)
AccountCreateTransaction(27-380)set_key_without_alias(94-107)
examples/account/account_create_transaction_evm_alias.py (1)
src/hiero_sdk_python/account/account_create_transaction.py (2)
AccountCreateTransaction(27-380)set_key_with_alias(109-135)
🪛 Ruff (0.14.8)
tests/unit/account_create_transaction_test.py
388-388: pytest.raises(ValueError) is too broad, set the match parameter or use a more specific exception
(PT011)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (9)
examples/account/account_create_transaction_evm_alias.py (1)
54-58: LGTM: Correct migration toset_key_with_alias.The refactoring properly replaces the deprecated
set_key()+ manual alias derivation withset_key_with_alias(public_key), which automatically derives the EVM address alias from the provided ECDSA public key. Method chaining and transaction flow are preserved correctly.examples/tokens/token_create_transaction_wipe_key.py (1)
38-38: NftId import and constructor usage are correct.The import
from hiero_sdk_python import NftIdis valid (exported at top-level viasrc/hiero_sdk_python/__init__.py). The constructor callNftId(token_id, serial_number)on line 317 matches the signature correctly.tests/unit/account_create_transaction_test.py (7)
43-48: LGTM! Correct migration toset_key_without_alias().The update correctly replaces the deprecated
set_key()method withset_key_without_alias()for this standard account creation test case. The method chaining and test logic remain intact.
68-74: LGTM! Correct API usage for scheduled transaction test.The migration to
set_key_without_alias()is appropriate for this schedulable transaction test scenario.
103-108: LGTM! Appropriate method for signing test.The change correctly uses
set_key_without_alias()for this transaction signing test.
168-172: LGTM! Integration test correctly updated.The migration to
set_key_without_alias()is correct for this integration test scenario.
188-193: LGTM! Correct method usage.The update to
set_key_without_alias()is appropriate for this error-handling test.
235-239: LGTM! Appropriate for this test scenario.The change to
set_key_without_alias()is correct for testingmax_automatic_token_associations.
391-397: LGTM! Correct method usage.The migration to
set_key_without_alias()is appropriate for this type validation test.
|
Hi! 👋 Just wanted to check on scope before making further changes. |
|
Hi that is ok, please focus on the issue, and if there is a need to correct anything else, I can help to create a new issue (or you can, if you think it is important). Some of its feedback was incorrect, for example, it is not a critical issue that it is not signing, because .execute will do that anyway with the operator. |
exploreriii
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @prishajaiswal75
Excellent work here! Thank you so much for doing all this
I think you have replaced the outdated method with the new method, but you have not removed the deprecated set_key method. I like this approach because removing set_key will break virtually every user, even though we have had this deprecation message.
So this PR just nudges people to use the new methods, but does not change the availability of the original set_key method if they really want to do that.
That is good - i think it will give us more time to consider how to handle this sensitive change.
I have left some minor feedback - but generally I like this.
I will recommend parking this PR for a bit of time to wait for @manishdait and @nadineloepfe to feedback as it is a sensitive topic.
Once you have completed the minor feedbakc, please feel free to sign up to another issue if you'd like, while you wait
Thank you
|
Thanks for the refactor! While reviewing the PR, I noticed a blocking correctness issue in the unit tests that is currently causing CI failures:
To keep this PR within scope, I’d suggest one of the following:
No rush as this PR is waiting for additional reviews :) |
|
Hi, this is MergeConflictBot. Please resolve these conflicts locally and push the changes. To assist you, please read: Thank you for contributing! |
|
Hi @prishajaiswal75, This pull request has had no commit activity for 10 days. Are you still working on the issue? please push a commit to keep the PR active or it will be closed due to inactivity. From the Python SDK Team |
|
Hi @prishajaiswal75 are you still working on this |
|
Hello , only 1-2 minor corrections are remaining the ones which were told
rest is done I was a little occupied for a while but it’d be completed by
tomorrow
…On Sat, 3 Jan 2026 at 6:00 PM, Manish Dait ***@***.***> wrote:
*manishdait* left a comment (hiero-ledger/hiero-sdk-python#1195)
<#1195 (comment)>
Hi @prishajaiswal75 <https://github.com/prishajaiswal75> are you still
working on this
—
Reply to this email directly, view it on GitHub
<#1195 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BHHZNIIQJTXTNVCONDIDEJ34E6Y6HAVCNFSM6AAAAACPYEPR56VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTOMBXGAZDGNRWHE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
<https://www.facebook.com/SITLavale/>
<https://www.instagram.com/symbiosis_sitpune>
<https://www.linkedin.com/in/sitpune/>
**Disclaimer:** *This
email is governed by the Disclaimer Terms of SIU which may be viewed at
*http://www.siu.edu.in/downloads/email-disclaimer.php
<http://www.siu.edu.in/downloads/email-disclaimer.php>
|
) Signed-off-by: Adityarya11 <[email protected]> Signed-off-by: prishajaiswal75 <[email protected]>
Signed-off-by: prishajaiswal75 <[email protected]>
c72a5ce to
94eb7a4
Compare
exploreriii
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hI @prishajaiswal75
thank you for picking this up again and going through all that extra effort resolving the conflicts!
We have one outstanding issue with your signing
looking at:
https://github.com/hiero-ledger/hiero-sdk-python/pull/1195/commits
it looks like you are trying to resign a previous commit from another person
I'm not sure exactly what happened here, so its hard for me to give you a concrete guide to fix this
Maybe you can try a rebase and a soft revert
git reset --soft HEAD~n
git reset main -S
i don't know whether to go back 1 commit or 2 commits, maybe you'll need to try both
would recommend creating a back up branch!
|
Closing this PR and reopening with a clean branch due to polluted commit history. |
|
the thing is i did it by mistake and thats why i closed the pull request
and fresh started mine cherry picking it
…On Mon, Jan 5, 2026 at 3:20 AM exploreriii ***@***.***> wrote:
***@***.**** requested changes on this pull request.
hI @prishajaiswal75 <https://github.com/prishajaiswal75>
thank you for picking this up again and going through all that extra
effort resolving the conflicts!
We have one outstanding issue with your signing
looking at:
https://github.com/hiero-ledger/hiero-sdk-python/pull/1195/commits
it looks like you are trying to resign a previous commit from another
person
I'm not sure exactly what happened here, so its hard for me to give you a
concrete guide to fix this
Maybe you can try a rebase and a soft revert
git reset --soft HEAD~n
git reset main -S
i don't know whether to go back 1 commit or 2 commits, maybe you'll need
to try both
would recommend creating a back up branch!
—
Reply to this email directly, view it on GitHub
<#1195 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BHHZNIOAX7WUYDNCPSFGOOD4FGDLRAVCNFSM6AAAAACPYEPR56VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTMMRVGE4DMNZZGQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
<https://www.facebook.com/SITLavale/>
<https://www.instagram.com/symbiosis_sitpune>
<https://www.linkedin.com/in/sitpune/>
**Disclaimer:** *This
email is governed by the Disclaimer Terms of SIU which may be viewed at
*http://www.siu.edu.in/downloads/email-disclaimer.php
<http://www.siu.edu.in/downloads/email-disclaimer.php>
|
|
and i dont know why it was still showing that it was unsigned although i
had reset refreshed and tried again
On Tue, Jan 6, 2026 at 11:52 PM Prisha.Jaiswal Btech2023 <
***@***.***> wrote:
… the thing is i did it by mistake and thats why i closed the pull request
and fresh started mine cherry picking it
On Mon, Jan 5, 2026 at 3:20 AM exploreriii ***@***.***>
wrote:
> ***@***.**** requested changes on this pull request.
>
> hI @prishajaiswal75 <https://github.com/prishajaiswal75>
> thank you for picking this up again and going through all that extra
> effort resolving the conflicts!
>
> We have one outstanding issue with your signing
> looking at:
> https://github.com/hiero-ledger/hiero-sdk-python/pull/1195/commits
>
> it looks like you are trying to resign a previous commit from another
> person
> I'm not sure exactly what happened here, so its hard for me to give you a
> concrete guide to fix this
>
> Maybe you can try a rebase and a soft revert
> git reset --soft HEAD~n
> git reset main -S
>
> i don't know whether to go back 1 commit or 2 commits, maybe you'll need
> to try both
> would recommend creating a back up branch!
>
> —
> Reply to this email directly, view it on GitHub
> <#1195 (review)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/BHHZNIOAX7WUYDNCPSFGOOD4FGDLRAVCNFSM6AAAAACPYEPR56VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTMMRVGE4DMNZZGQ>
> .
> You are receiving this because you were mentioned.Message ID:
> ***@***.***>
>
--
<https://www.facebook.com/SITLavale/>
<https://www.instagram.com/symbiosis_sitpune>
<https://www.linkedin.com/in/sitpune/>
**Disclaimer:** *This
email is governed by the Disclaimer Terms of SIU which may be viewed at
*http://www.siu.edu.in/downloads/email-disclaimer.php
<http://www.siu.edu.in/downloads/email-disclaimer.php>
|
This PR refactors all usages of the deprecated AccountCreateTransaction.set_key() method and replaces them with the appropriate non-deprecated alternatives, ensuring correct behavior and eliminating deprecation warnings.
Changes Made
Examples
Updated all example files across account, token, query, schedule, consensus, transaction, and logger directories.
Replaced AccountCreateTransaction.set_key() with:
Tests
EVM Alias Handling
Verification
Searched the codebase to ensure no remaining usages of AccountCreateTransaction.set_key() remain.
Confirmed that all other transaction types continue to use their valid, non-deprecated set_key() methods.
Related Issue
Fixes #1170